package org.flyby.component;

import org.apache.wicket.ajax.IAjaxIndicatorAware;
import org.apache.wicket.ajax.markup.html.AjaxLink;
import org.apache.wicket.markup.head.OnDomReadyHeaderItem;
import org.apache.wicket.markup.html.internal.HtmlHeaderContainer;
import org.apache.wicket.model.IModel;

public abstract class FlybyIndicatingAjaxLink extends AjaxLink implements IAjaxIndicatorAware {

    public FlybyIndicatingAjaxLink(String id) {
        super(id);
    }

    @Override
    public void renderHead(HtmlHeaderContainer container) {
        super.renderHead(container);
        container.getHeaderResponse().render(OnDomReadyHeaderItem.forScript("$('a').button();"));
    }

    public FlybyIndicatingAjaxLink(String id, IModel model) {
        super(id, model);
    }

    @Override
    public String getAjaxIndicatorMarkupId() {
        return "loadingIndicator";
    }

}
